import DataColumn from './dataColumn.js'
export default class DataColumnDate extends DataColumn {

	//与SimpleDateFormat要求一致
	displayFormat = "yyyy-MM-dd";

	constructor(name) {
		super(name);
		
		this.setAlignment("Center");
		this.setDisplayLength(12);
	}

	getDisplayFormat() {
		return this.displayFormat;
	}

	setDisplayFormat(displayFormat) {
		this.displayFormat = displayFormat;
	}
	
	getDefaultValue() {
		let myDate = new Date()
		let year = myDate.getFullYear()
		let month = myDate.getMonth()>9?myDate.getMonth():"0"+myDate.getMonth()
		let day = myDate.getDate()>9?myDate.getDate():"0"+myDate.getDate()
		return year+"-"+month+"-"+day;
	}
	
	getDataType() {
		return "TypeDate";
	}
}
